<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title></title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="icon" href="">
    <link href="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/nprogress/nprogress.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/fonts/font-awesome/font-awesome.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/icheck/icheck.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/animate/animate.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.css?v=1.1" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/common/common_20170925.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/inside/inside.css?v=1" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/file/file.css" rel="stylesheet">
    <%
		var isAdd = false;
		var isEdit = false;

		if(isEmpty(productCategory.id)){
		isAdd = true;
		}else{
		isEdit = true;
    }%>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content ibox float-e-margins">
    <div class="ibox-title">
        <div class="pull-left mbx">
            商品管理<span class="line">/</span>
            <a href="/shop/productCategroy/list" class="mbxsecond">商品类型</a><span class="line">/</span>
            <span class="current"><%if(isAdd){%>添加商品分类<%}else{%>编辑商品分类<%}%></span>
        </div>
    </div>
    <div class="ibox-content">
        <form  action="<%if (isAdd){%>${base}/shop/productCategroy/save<%}else{%>${base}/shop/productCategroy/update<%}%>" method="post" class="form-horizontal" onsubmit="return check()">
            <input type="hidden" name="productCategory.id" value="${productCategory.id!}" />
            <div class="form-group">
                <label class="col-sm-2 control-label">分类名称：</label>
                <div class="col-sm-3">
                    <input type="text" name="productCategory.name" id="productCategoryName" value="${productCategory.name!}" class="form-control input-sm" maxlength="10" required="true">
                </div>
                <span class="help-block"><span class="maroon">*</span></span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">链接地址：</label>
                <div class="col-sm-3">
                    <input type="text"  name="productCategory.linkurl"  value="${productCategory.linkurl!}" class="form-control input-sm" maxlength="10">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">分类图片:</label>
                <div class="col-sm-3">
                    <input type="hidden" name="productCategory.image" value="" class="pull-left form-control input-sm"/>
                    <img class="img-rounded" src="${productCategory.image!}" style="max-height:50px;"/>
                    <input type="button" class="button browserButton" value="选择文件"/>
                    <span class="help-block"><span class="maroon"></span>建议300*300像素；格式jpg</span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">上级分类：</label>
                <div class="col-sm-3">
                    <%if(isAdd){%>

                    <select name="parentId" class="form-control input-sm" style="height: 31px">
                        <option value="">顶级分类</option>
                        <%for(list in productCategoryTreeList){%>
                        <option value="${list.id}">
                            <%if (list.level != 0){%>
                            <%for( i in range(0,list.level)){%>------<%}%>
                            <%}%>
                            ${list.name}
                        </option>
                        <%}%>
                    </select>
                    <%}else{%>
                    ${productCategory.parent.name!'顶级分类'}
                    <%}%>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">排序：</label>
                <div class="col-sm-3">
                    <input type="text"  name="productCategory.orderList"  value="${productCategory.orderList!}" class="form-control input-sm" maxlength="10" required="true">
                </div>
                <span class="help-block"><span class="maroon">*</span>请输入0-999正整数</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">页面关键词：</label>
                <div class="col-sm-3">
                    <input type="text"  name="productCategory.metaKeywords"  value="${productCategory.metaKeywords!}" class="form-control input-sm" maxlength="10">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">页面描述：</label>
                <div class="col-sm-3">
                    <textarea name="productCategory.metaDescription"  rows="" style="" class="form-control input-sm">${productCategory.metaDescription!}</textarea>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-2">
                    <button class="btn btn-primary" type="submit">保存</button>
                    <button class="btn btn-white" onclick="history.back()" type="button">取消</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/nprogress/nprogress.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/jquery.validate.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/additional-methods.min.js"></script>

<script src="https://static.9hive.cn/global/vendor/jquery-validate/localization/messages_zh.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-ajaxform/ajax-form.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
<!-- 自定义js -->
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>
<script src="https://static.9hive.cn/global/vendor/file/uploadify/jquery_uploadify.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript">
    var uploadUrl="/file/uploadfile?shopId=${shopId!}&type=d";
    var browserUrl="/file/browser?shopId=${shopId!}";
</script>
<script src="https://static.9hive.cn/global/vendor/file/file.js"></script>
<script type="text/javascript">
    $(function () {
        $("input.browserButton").browser();
    })
</script>
<script type="text/javascript">
    function check(){
        var productCategoryName=$("#productCategoryName").val();
        var productCategoryOrderList=$("input[name='productCategory.orderList']").val();
        var listReg=/^\d*\d*\d+$/;
        if(!productCategoryName){
            layer.msg("请输入商品分类名称!");
            return false;
        }
        if(!listReg.test(productCategoryOrderList) || parseInt(productCategoryOrderList)>999){
            layer.msg("排序请输入0-999的正整数!");
            return false;
        }
    }
</script>
</html>
